create table Age
(
	 [AgeId] int identity(1, 1) primary key
	,[AgeName] nvarchar(128)
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

CREATE PROCEDURE AgeGet
	@AgeId int
AS
SELECT *
FROM [Age]
WHERE [Age].[AgeId] = @AgeId
GO

CREATE PROCEDURE AgeList
AS
SELECT *
FROM [Age]
ORDER BY AgeId DESC
GO

CREATE PROCEDURE AgeInsert
	@AgeName nvarchar(128)
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO Age (
	 [AgeName]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @AgeName
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

CREATE PROCEDURE AgeUpdate
	@AgeId int, 
	@AgeName nvarchar(128), 
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 

AS

UPDATE Age SET
	   [AgeName] = @AgeName
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [Age].[AgeId] = @AgeId
GO

CREATE PROCEDURE AgeDelete
	@AgeId int 
AS
DELETE FROM Age
WHERE [Age].[AgeId] = @AgeId
GO